const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const { HotModuleReplacementPlugin } = require('webpack');
const { merge } = require('webpack-merge');
const common = require('./webpack.common');
const devConfig = {
  mode: 'development',
  devServer: {
      port: 8000,
      static: '../dist',
      open: true,
      hot: true,
  },
  target: 'web',
  plugins: [new HotModuleReplacementPlugin(), new ReactRefreshWebpackPlugin()],
  devtool: 'eval-cheap-module-source-map',
};

module.exports = merge(common, devConfig);
// const devConfig = {
//   mode: 'development',
//   devServer: {
//     port: '8080',
//     // static: paths.build, // 将dist目录代理到dev服务器上，实现代码热更新
//     contentBase: '../dist',
//     hot: true, // 开启热更新
//     open:true,
   
//   },
//   target:'web',
//   plugins: [new ReactRefreshWebpackPlugin(), new HotModuleReplacementPlugin()],
//   devtool: 'eval-cheap-module-source-map',
// };

// module.exports = merge(common,devConfig)
